package utils

/**
  仓库, 用于存储对象
*/

var (
	instance_storage GSyncMapGroup
)

func StorageSet(key interface{}, obj interface{}) {
	instance_storage.Set(key, obj)
}

func StorageGet(key interface{}) interface{} {
	return instance_storage.Get(key, nil)
}

func StorageRange(cb func(key, val interface{}) bool) int {
	n := 0
	instance_storage.Range(func(key, val interface{}) bool {
		if !cb(key, val) {
			return false
		}
		n++
		return true
	})
	return n
}
